import React, { Component } from 'react'
import {connect} from "react-redux"
import {createIncrementAction} from "../../redux/action/count"



class Count2 extends Component {
    addSum = () => {
        this.props.add(1*1)
    }
    render() {
        return (
            <div>
                <h1>当前求和为：{this.props.sum}</h1>
                <button onClick={this.addSum}>点我+1</button>
            </div>
        )
    }
}

export default connect(
    state => ({sum:state}), // 映射状态
    {
        add:createIncrementAction
    } // 映射操作状态的方法
)(Count2)